import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SkuSalesEstimationVO, SkuSalesEstimationForm, SkuSalesEstimationQuery } from '@/api/skuSalesEstimation/types';

/**
 * 查询销量预估列表
 * @param query
 * @returns {*}
 */

export const listSkuSalesEstimation = (query?: SkuSalesEstimationQuery): AxiosPromise<SkuSalesEstimationVO[]> => {
  return request({
    url: '/oa/skuSalesEstimation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询销量预估详细
 * @param id
 */
export const getSkuSalesEstimation = (id: string | number): AxiosPromise<SkuSalesEstimationVO> => {
  return request({
    url: '/oa/skuSalesEstimation/' + id,
    method: 'get'
  });
};

/**
 * 新增销量预估
 * @param data
 */
export const addSkuSalesEstimation = (data: SkuSalesEstimationForm) => {
  return request({
    url: '/oa/skuSalesEstimation',
    method: 'post',
    data: data
  });
};

/**
 * 修改销量预估
 * @param data
 */
export const updateSkuSalesEstimation = (data: SkuSalesEstimationForm) => {
  return request({
    url: '/oa/skuSalesEstimation',
    method: 'put',
    data: data
  });
};

/**
 * 删除销量预估
 * @param id
 */
export const delSkuSalesEstimation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/oa/skuSalesEstimation/' + id,
    method: 'delete'
  });
};
